package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.framework.util.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.BizOrderDeliveryMapper;
import com.ruoyi.business.domain.BizOrderDelivery;
import com.ruoyi.business.service.IBizOrderDeliveryService;
import com.ruoyi.common.core.text.Convert;

import javax.annotation.Resource;

/**
 * 发货Service业务层处理
 *
 * @author ruoyi
 * @date 2020-10-20
 */
@Service
public class BizOrderDeliveryServiceImpl implements IBizOrderDeliveryService
{
    @Resource
    private BizOrderDeliveryMapper bizOrderDeliveryMapper;

    /**
     * 查询发货
     *
     * @param id 发货ID
     * @return 发货
     */
    @Override
    public BizOrderDelivery selectBizOrderDeliveryById(Long id)
    {
        return bizOrderDeliveryMapper.selectBizOrderDeliveryById(id);
    }

    /**
     * 查询发货列表
     *
     * @param bizOrderDelivery 发货
     * @return 发货
     */
    @Override
    public List<BizOrderDelivery> selectBizOrderDeliveryList(BizOrderDelivery bizOrderDelivery)
    {
        return bizOrderDeliveryMapper.selectBizOrderDeliveryList(bizOrderDelivery);
    }

    /**
     * 新增发货
     *
     * @param bizOrderDelivery 发货
     * @return 结果
     */
    @Override
    public int insertBizOrderDelivery(BizOrderDelivery bizOrderDelivery)
    {
        bizOrderDelivery.setCreateBy(ShiroUtils.getLoginName());
        bizOrderDelivery.setCreateTime(DateUtils.getNowDate());
        return bizOrderDeliveryMapper.insertBizOrderDelivery(bizOrderDelivery);
    }

    /**
     * 修改发货
     *
     * @param bizOrderDelivery 发货
     * @return 结果
     */
    @Override
    public int updateBizOrderDelivery(BizOrderDelivery bizOrderDelivery)
    {
        bizOrderDelivery.setUpdateTime(DateUtils.getNowDate());
        return bizOrderDeliveryMapper.updateBizOrderDelivery(bizOrderDelivery);
    }

    /**
     * 删除发货对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBizOrderDeliveryByIds(String ids)
    {
        return bizOrderDeliveryMapper.deleteBizOrderDeliveryByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除发货信息
     *
     * @param id 发货ID
     * @return 结果
     */
    @Override
    public int deleteBizOrderDeliveryById(Long id)
    {
        return bizOrderDeliveryMapper.deleteBizOrderDeliveryById(id);
    }
}
